package com.meihuak.cloud_ordering.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.meihuak.cloud_ordering.bean.Manager;
import com.meihuak.cloud_ordering.mapper.ManagerMapper;
import com.meihuak.cloud_ordering.service.ManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 韩迪
 * @date 2022/04/05 14:38
 **/
@Service
public class ManagerServiceImpl extends ServiceImpl<ManagerMapper, Manager> implements ManagerService {


    /**
     * 通过账号密码登陆
     */
    @Override
    public Manager login(String uno,String key) {
        QueryWrapper<Manager> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("uno",uno)
                .eq("userkey",key)
                .last("limit 1");
        return this.getOne(queryWrapper);
    }

    /**
     * 判断管理员是否存在
     */
    @Override
    public boolean isExist(int id){
        return this.getById(id) != null;
    }

}
